import loginPage from "../components/pages/loginPage.vue";
import mainPage from "../components/pages/mainPage.vue";
import personalRec from "../components/main/mainMsg/findMusic/personalRec.vue";
import playList from "../components/main/mainMsg/findMusic/playList.vue";
import findMusic from "../components/main/mainMsg/findMusic.vue";
import recentPlay from "../components/main/mainMsg/recentPlay.vue";
import dynamicBox from "../components/main/mainMsg/dynamicBox.vue";
import myDj from "../components/main/mainMsg/myDj.vue";
import playListPage from "../components/main/mainMsg/playListPage.vue";

const routes = [
    {
        name:'login',
        path:'/login',
        component:loginPage,
        meta:{
            isAuth:true,
            title:'欢迎，请登录'
        },
    },
    {
        name:'main',
        path:'/main',
        component: mainPage,
        meta:{
            isAuth:true,
            title:'主页'
        },
        beforeEnter:(to, from, next)=>{
            if (localStorage.getItem('test') === 'elijah') {
                next()
            }
        },
        children:[
            {
                name: 'music',
                path: '/main/music',
                component: findMusic,
                meta:{
                    title:'发现音乐'
                },
                children:[
                    {
                        name:'personal',
                        path:'/main/music/',
                        component:personalRec,
                        meta:{
                            title:'个性推荐'
                        },
                    },
                    {
                        name:'playList',
                        path:'/main/music/playList',
                        component:playList,
                        meta:{
                            title:'歌单广场'
                        },
                    },
                ]
            },
            {
                name: 'recent',
                path: '/main/recent',
                component: recentPlay,
                meta:{
                    title:'最近播放'
                },
            },
            {
                name: 'dynamic',
                path: '/main/dynamic',
                component: dynamicBox,
                meta:{
                    title:'关注动态'
                },
            },
            {
                name: 'dj',
                path: '/main/dj',
                component: myDj,
                meta:{
                    title:'我的电台'
                },
            },
            {
                name: 'playList',
                path: '/main/playList',
                component: playListPage,
                meta:{
                    title:'歌单'
                },
            },
        ]
    }
]

export default routes